package top.kpromise.ibase.lifecycle

import android.app.Activity
import android.content.Intent

private interface CommonLifeCycle {
    fun onCreate(activity: Activity)
    fun onResume(activity: Activity)
    fun onPause(activity: Activity)
    fun onStop(activity: Activity)
    fun onDestroy(activity: Activity)
    fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?)
}

open class CommonCallBack(private val nextLifeCycle: CommonCallBack?): CommonLifeCycle {
    override fun onCreate(activity: Activity) {
        nextLifeCycle?.onCreate(activity)
    }

    override fun onResume(activity: Activity) {
        nextLifeCycle?.onResume(activity)
    }

    override fun onPause(activity: Activity) {
        nextLifeCycle?.onPause(activity)
    }

    override fun onStop(activity: Activity) {
        nextLifeCycle?.onStop(activity)
    }

    override fun onDestroy(activity: Activity) {
        nextLifeCycle?.onDestroy(activity)
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
        nextLifeCycle?.onActivityResult(requestCode, resultCode, intent)
    }
}